package com.huawei.appgallery.forum.message.activity;

import android.os.Bundle;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.forum.message.api.IBuoyMsgSwitchSettingActivityProtocol;
import com.huawei.appgallery.forum.message.api.IBuoyMsgSwitchSettingActivityResult;
import com.huawei.appgallery.forum.message.api.IBuoyMsgSwitchSettingFragmentProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.e;
import com.huawei.appgallery.foundation.ui.framework.fragment.LoadingFragment;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.hmf.annotation.ActivityDefine;
import java.util.List;
import o.bqx;
import o.bvj;
import o.bvj.j;
import o.bvv;
import o.bvw;
import o.cvt;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjm;
import o.FragmentTransaction;

@ActivityDefine(alias = "buoy_msg_setting_activity", protocol = IBuoyMsgSwitchSettingActivityProtocol.class, result = IBuoyMsgSwitchSettingActivityResult.class)
public class BuoyMsgSwitchSettingActivity extends LauncherMsgSwitchSettingActivity implements e {
    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
    }

    protected void ˊ(TextView textView) {
        textView.setText(getResources().getString(j.ॱˊ));
    }

    public boolean ˋ(TaskFragment taskFragment, b bVar) {
        if ((bVar.ˊ instanceof bvw) && (bVar.ˋ instanceof bvv)) {
            bvv o_bvv = (bvv) bVar.ˋ;
            if (o_bvv.getRtnCode_() == 0 && o_bvv.getResponseCode() == 0) {
                ˏ(o_bvv);
            } else {
                ॱ(taskFragment, o_bvv);
            }
        }
        return false;
    }

    private void ॱ(TaskFragment taskFragment, bvv o_bvv) {
        if (taskFragment instanceof LoadingFragment) {
            ((LoadingFragment) taskFragment).ॱ(ॱ((ResponseBean) o_bvv), true);
        }
    }

    private void ˏ(bvv o_bvv) {
        fjb ˎ = fho.ˏ().ˋ("Message").ˎ("buoy_msg_setting_fragment");
        IBuoyMsgSwitchSettingFragmentProtocol iBuoyMsgSwitchSettingFragmentProtocol = (IBuoyMsgSwitchSettingFragmentProtocol) ˎ.ˊ();
        iBuoyMsgSwitchSettingFragmentProtocol.setFollowMsgSwitch(o_bvv.ॱ());
        iBuoyMsgSwitchSettingFragmentProtocol.setGrowthMsgSwitch(o_bvv.ˋ());
        iBuoyMsgSwitchSettingFragmentProtocol.setImportantMsgSwitch(o_bvv.ˎ());
        iBuoyMsgSwitchSettingFragmentProtocol.setLikeMsgSwitch(o_bvv.ˏ());
        iBuoyMsgSwitchSettingFragmentProtocol.setReplyMsgSwitch(o_bvv.ˊ());
        iBuoyMsgSwitchSettingFragmentProtocol.setPushMsgSwitch(o_bvv.ᐝ());
        iBuoyMsgSwitchSettingFragmentProtocol.setReviewMsgSwitch(o_bvv.ʽ());
        try {
            fjm ˏ = fjm.ˏ(fiu.ˊ().ˋ(this, ˎ));
            FragmentTransaction ˊ = ˏॱ().ˊ();
            ˊ.ˏ(bvj.b.ˍ, ˏ.ˏ(), "BuoyMsgSwitchSettingActivity");
            ˊ.ˋ();
        } catch (Exception e) {
            bqx.ˋ("BuoyMsgSwitchSettingActivity", "show setting fragment error: " + e.toString());
        }
    }

    protected int ॱ(ResponseBean responseBean) {
        int responseCode = responseBean.getResponseCode();
        if (responseCode != 0 || responseBean.getRtnCode_() == 0) {
            return responseCode;
        }
        return 1;
    }

    public void ˎ(TaskFragment taskFragment, List<cvt> list) {
        list.add(new bvw(this.ˊॱ));
    }

    protected void ॱ(Bundle bundle) {
        if (bundle == null) {
            new LoadingFragment().ˋ(ˏॱ(), bvj.b.ˍ, "BuoyMsgSwitchSettingActivity");
        }
    }
}
